package com.example.es.restclient.web;

import com.example.es.restclient.pojo.PageResult;
import com.example.es.restclient.pojo.RequestParams;
import com.example.es.restclient.service.HotelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/hotel")
public class HotelController {

	@Autowired
	private HotelService hotelService;

	@PostMapping("/list")
	public PageResult search(@RequestBody RequestParams params) {
		return hotelService.search(params);
	}


	@PostMapping("/filters")
	public Map<String, List<String>> getFilters(@RequestBody RequestParams params) {
		return hotelService.filters( params);
	}


	@GetMapping("/suggestion")
	public List<String> getSuggestion(@RequestParam("key") String key){
		return hotelService.getSuggestion( key);
	}



}
